package com.ccc.model;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Ad entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "ad")
public class Ad implements java.io.Serializable {

	// Fields

	private Integer adId;
	private Product product;
	private Integer currentTime;
	private Integer adPrice;
	private User user;
	private Integer sellPrice;


	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "adId", unique = true, nullable = false)
	public Integer getAdId() {
		return this.adId;
	}

	public void setAdId(Integer adId) {
		this.adId = adId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "productId", nullable = false)
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", nullable = false)
	public User getUser(){
		return this.user;
	}
	
	public void setUser(User user){
		this.user=user;
	}

	@Column(name = "currentTime", nullable = false)
	public Integer getCurrentTime() {
		return this.currentTime;
	}

	public void setCurrentTime(Integer currentTime) {
		this.currentTime = currentTime;
	}

	@Column(name = "adPrice", nullable = false)
	public Integer getAdPrice() {
		return this.adPrice;
	}

	public void setAdPrice(Integer adPrice) {
		this.adPrice = adPrice;
	}
	
	@Column(name="sellPrice",nullable = true)
	public Integer getSellPrice() {
		return sellPrice;
	}

	public void setSellPrice(Integer sellPrice) {
		this.sellPrice = sellPrice;
	}

}